package com.suray.type;

/**
 * 6代车roller模式
 */
public enum Rgv60RollerMode {
    INVALID(-1, "无效"),
    MANUAL(0, "手动"),
    AUTO(1, "自动"),
    ;

    Integer value;
    String des;
    Rgv60RollerMode(int value, String des) {
        this.value = value;
        this.des = des;
    }

    public Integer getValue() {
        return value;
    }

    public static Rgv60RollerMode parseMode(Boolean bool) {
        if (bool == null) {
            return INVALID;
        }

        int value = bool ? 1 : 0;

        for (Rgv60RollerMode mode : Rgv60RollerMode.values()) {
            if (mode.value.equals(value)) {
                return mode;
            }
        }

        return INVALID;
    }

    @Override
    public String toString() {
        return des;
    }
}
